/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 playing_sound.h

	$Header: /heroes4/playing_sound.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( PLAYING_SOUND_H_INCLUDED )
#define PLAYING_SOUND_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "playing_sound_ptr.h"
#include "sound.h"

enum t_play_posiiton_states
{
		k_playing_uninitalized_buffer,
		k_playing_first_half,
		k_playing_second_half,
		k_filled_first_half,
		k_filled_second_half
};

// ------------------------------------------------------
// abstract class representing a playing sound
// ------------------------------------------------------
class t_playing_sound : public t_counted_object
{
public:
	t_playing_sound( t_sound const& sound );

	virtual int  get_balance() const = 0;
	virtual int  get_volume() const = 0;
	virtual int  get_type() const = 0;
	virtual void fade_out( bool close_on_stop = true ) = 0;
	virtual bool is_fading_out() const = 0;
	bool         is_looping() const;
	bool         is_playing() const;
	virtual void play( int volume = 0, bool looping = false, bool fade_in = false ) = 0;
	virtual void set_balance( int arg ) = 0;  // -10000 (left) to 10000 (right)
	virtual void set_volume( int volume, bool interpolate_to_volume = false ) = 0; // 0 to -10000
	virtual void stop( bool close_on_stop = true ) = 0;
protected:
	bool						m_close_on_stop;
	bool						m_looping;
	bool						m_fading_in;
	bool						m_playing;
	t_play_posiiton_states		m_play_position_state;
	int							m_priority;
	t_sound						m_sound;
	t_sound_stream_ptr			m_sound_data;
	int							m_type;
};

inline bool t_playing_sound::is_looping() const
{
	return m_looping;
}

inline bool t_playing_sound::is_playing() const
{
	return m_playing;
}

#endif // PLAYING_SOUND_H_INCLUDED